﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TaggerApp.Authentication;

namespace TaggerApp.Pages.Login
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            oAuthLiveImpl oauth = new oAuthLiveImpl();
            if (Request.QueryString["code"] == null)
            {
                oauth.initialLogin(Response);
            }
            else {
                String token = oauth.getToken(Request);
                User myUser = oauth.getUserInfo(token);
                Session["user"] = myUser;
                loginMessage.InnerText = "You are logged in as: " + myUser.FirstName;
            }
        }
    }
}